/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __XOS_ODBC_IMPL_ODBC_CONNECT_POOL_H__
#define __XOS_ODBC_IMPL_ODBC_CONNECT_POOL_H__

#include "../tools/head.h"
#include "include_odbc.h"

namespace xos_odbc
{

    class odbc_connect_pool : public xos_stl::mem_item< xos::release_impl< odbc_connect_pool >, thread_lock >,
		public i_connect_pool
    {
    public:
        typedef xos::release_impl< odbc_connect_pool > T;

    public:
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        static int get_xos_item_data( ITEM_DATA*& item_ptr );

    public:
        odbc_connect_pool();
        ~odbc_connect_pool();

    public:
        int set_connect_str( const char * lpszConnectStr );
        int put( i_connect *& pConnect );
        i_connect * get();

    protected:
        xos_box::i_list * m_pConnectList;
        std::string m_connect_str;

    protected:
        int init_data();

    public:
        int init();
        int term();

    };

} // xos_odbc

#endif // __XOS_ODBC_IMPL_ODBC_CONNECT_POOL_H__
